Path: blob/master/src/packages/next/pages/share/accounts/[account_id].tsx
1496 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6Page for a given user.7*/89/*10* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.11* License: MS-RSL – see LICENSE.md for details12*/1314import { join } from "path";15import basePath from "lib/base-path";16import getAccountInfo from "lib/share/get-account-info";17import withCustomize from "lib/with-customize";18import Account from "components/account/account";1920export default Account;2122export async function getServerSideProps(context) {23const { account_id } = context.params;24try {25const accountInfo = await getAccountInfo(account_id, context.req);26if (accountInfo.name) {27// This account has a nice username. Redirect to that instead28// of rendering here.29return { props: { redirect: join(basePath, accountInfo.name) } };30}31return await withCustomize({32context,33props: accountInfo,34});35} catch (_err) {36// console.log(err);37return { notFound: true };38}39}404142